package homework.test3;

import homework.test1.Domain.User;

import java.io.*;

/*
// 4.使用序列化流,完成User对象的序列化和反序列化
 */
public class Demo4 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        ObjectOutputStream ois = new ObjectOutputStream(new FileOutputStream("Day13\\src\\homework\\test3\\a.txt"));

        User user = new User("张三",23,"12345","1","1");

        ois.writeObject(user);
        ois.close();

        ObjectInputStream oos = new ObjectInputStream(new FileInputStream("Day13\\src\\homework\\test3\\a.txt"));
        User user1 = (User) oos.readObject();
        System.out.println(user1);

    }
}
